import request from "@/utils/request";

/**
 * 文件名: workFlow.js
 * 描述：工作流相关接口
 *
 */

/**
 * 这个是获取动态工作流id的
 * @param workFlowId 工作流模板id
 * @returns {*}
 */
export function getActionStatusMapByTemplate(workFlowId){
    return request({
        url: '/sysmanager/WorkflowTemplate/getActionStatusMapByTemplate',
        method: 'post',
        data: {identity: workFlowId},
    })
}

/**
 * 提交工作流
 * {identity:workFlowId,action:action,note:note}
 * @param workFlowId 工作流ID
 * @param action 是动作关系id
 * @param note 是描述可为空
 * @returns {*}
 */
export function submitWorkFlow(workFlowId, action, note){
    console.log('请求参数：', {identity:workFlowId,action:action,note:note})
    return request({
        url: '/sysmanager/WorkflowTemplate/submitWorkFlow',
        method: "post",
        data: {identity:workFlowId,action:action,note:note}
    })
}

/**
 *
 * 保存工作流
 * @param identity 模板ID
 * @param action 动作信息
 * @param createGroup 创建组
 * @param targetGroup 接收组
 * @returns {*}
 */
export function saveWorkFlow(identity, action, createGroup, targetGroup){
    return request({
        url: '/sysmanager/WorkflowTemplate/saveWorkFlow',
        method: 'post',
        data:{identity: identity, action:action, createGroup: createGroup, targetGroup: targetGroup},
    })
}